<template>
  <div>
      <p>ComB</p>
      <p>direct receive: {{msg1}}</p>
      <p>send receive: {{msg2}}</p>
  </div>
</template>

<script>
// 导入 EventBus.js
import EventBus from '../event-bus/EventBus.js'
export default {
  data () {
    return {
      msg1: '',
      msg2: ''
    }
  },
  // 组件创建完成，事件订阅，接收消息
  created () {
    EventBus.$on('direct', msg1 => (this.msg1 = msg1))
    EventBus.$on('send', msg2 => (this.msg2 = msg2))
  }
}
</script>

<style>

</style>
